package com.schoolcloud.serve.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.schoolcloud.serve.entity.SkuPicture;
import com.schoolcloud.serve.service.SkuPictureService;
import com.schoolcloud.serve.mapper.SkuPictureMapper;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author hongmizfb
* @description 针对表【sku_picture(sku的图片表)】的数据库操作Service实现
* @createDate 2025-04-12 17:11:02
*/
@Service
public class SkuPictureServiceImpl extends ServiceImpl<SkuPictureMapper, SkuPicture>
    implements SkuPictureService{

    @Override
    public void removeBySkuId(Integer skuId) {
        lambdaUpdate().eq(SkuPicture::getSkuId,skuId).remove();
    }

    @Override
    public List<String> getFileUrlListBySkuId(String id) {
       return lambdaQuery().eq(SkuPicture::getSkuId,id).list().stream().map(SkuPicture::getFileUrl).collect(Collectors.toList());
    }
}




